const { defineConfig } = require("@vue/cli-service");
// console.log(process.env);
let baseURL=process.env.VUE_APP_BASEURL
console.log("当前的环境是："+process.env.VUE_APP_ENV)
let env=process.env.NODE_ENV;
//别名配置的方法
const path = require('path');
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = defineConfig({
  publicPath:".",

  transpileDependencies: true,
  lintOnSave: false,
  outputDir:env==="test"?"testDist":"dist",
  devServer:{
    proxy:{
      "/api": {
        target:"http://www.chst.vip",
      pathRewrite:{
        "^/api":"",
      }
      }
      
    }
  },
   //配置别名:引入文件的路径都可以简写
   chainWebpack: (config) => {
    config.resolve.alias
      .set('%', resolve('src'))
      .set('assets', resolve('src/assets'))
      .set('components', resolve('src/components'))
      .set('layout', resolve('src/layout'))
      .set('base', resolve('src/base'))
      .set('static', resolve('src/static'))
  }
});
